#import "head.h"

#define EXPERIMENT_HOLDER_COUNT 8

#define ID_TYPE_WEAPON 0
#define ID_TYPE_ITEM 1
#define ID_TYPE_EXHIBITION 2

@class sprite_library_experiment_preview;

typedef struct SHolder_
{
	int piece_id;
	CGPoint position;
	CCSprite *piece;
	CCLabelTTF *label;
}
SHolder;

@interface layer_library_experiment : CCLayer
{
	bool flagTouchLock_;
	bool flagFunctionLock_;

	SHolder holder_[EXPERIMENT_HOLDER_COUNT];

	UICenterRect containerRect_;
	int selectId_;
	CCSprite *selectPiece_;

	int selectIdA_;
	int selectIdB_;
	CCSprite *selectPieceA_;
	CCSprite *selectPieceB_;

	CGPoint selectAPosition_;
	CGPoint selectBPosition_;

	int actionIdA_;
	int actionIdB_;
	sprite_library_experiment_preview *preview_;

	CCMenuItemImage *itemBack_;
}

@property (nonatomic, readwrite) bool flagTouchLock;
@property (nonatomic, readwrite) bool flagFunctionLock;

- (id)initLayerLibraryExperiment;
- (void)dealloc;

- (void)ccTouchesBegan:(NSSet *)Touch withEvent:(UIEvent *)Event;
- (void)ccTouchesMoved:(NSSet *)Touch withEvent:(UIEvent *)Event;
- (void)ccTouchesEnded:(NSSet *)Touch withEvent:(UIEvent *)Event;
- (void)ccTouchesCancelled:(NSSet *)Touch withEvent:(UIEvent *)Event;

- (void)HolderLoadPiece:(int)HolderIndex And:(int)Id;
- (void)HolderClear:(SHolder *)Holder;
- (int)GetHolderIndex:(int)PieceId;
- (void)SelectBackToHolder:(int)PieceId;

- (void)CheckAndCreate;
- (void)PreviewOver;

- (void)CallBackActionShake:(id)Sender;
- (void)CallBackMenuItemShake:(id)Sender;
- (void)CallBackMenuItemBack:(id)Sender;
- (void)CallBackMenuItemBackActionOver:(id)Sender;
- (void)CallBackPieceMoveBackOver:(id)Sender;
- (void)CallBackSelectPieceADisapper:(id)Sender;
- (void)CallBackSelectPieceBDisapper:(id)Sender;
- (void)CallBackCheckAndCreate:(id)Sender;

@end
